package com.ics.web.controller.travelstar.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ics.framework.util.PageUtil;
import com.ics.web.controller.travelstar.domain.TiresAsset;
import com.ics.web.controller.travelstar.dto.TiresAssetDTO;
import com.ics.web.controller.travelstar.mapper.TiresAssetMapper;
import com.ics.web.controller.travelstar.service.ITiresAssetService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

/**
 * @author shaoly
 * @description
 * @ClassName TiresAssetServiceImpl.java
 * @createTime 2024年09月23日 20:24:10
 */
@Service
public class TiresAssetServiceImpl extends ServiceImpl<TiresAssetMapper, TiresAsset> implements ITiresAssetService {


    @Override
    public IPage<TiresAsset> listPage(TiresAssetDTO assetDTO) {
        LambdaQueryWrapper<TiresAsset> wrapper = Wrappers.lambdaQuery();
        if (StringUtils.isNotBlank(assetDTO.getBigType())) {
            wrapper.eq(TiresAsset::getBigType, assetDTO.getBigType());
        }
        if (StringUtils.isNotBlank(assetDTO.getSmallType())) {
            wrapper.eq(TiresAsset::getSmallType, assetDTO.getSmallType());
        }
        wrapper.orderByAsc(TiresAsset::getAssetOrder);
        return this.baseMapper.selectPage(PageUtil.getPage(assetDTO), wrapper);
    }
}
